#ifndef _SEARCH_ENGINE_H_
#define _SEARCH_ENGINE_H_

#if defined(_MSC_VER)  &&  _MSC_VER >= 1310
# pragma warning( disable: 4996 )     // disable func_s deprecation warning
#endif 

#include <fstream>

#include "Generator.h"
#include "QueryOutput.h"
#include "Timer.h"

class SearchEngine
{
private:
	std::string name;

	int getAllQueryProperties(Query *query);
	void prepareQuery(Query *query);
protected:
	Query *query;

	Generator *generator;
	Generators generators;
	int currGenerator;

	QueryOutput *qOut;
	QueryStorage *qs;
	Timer *timer;

	int current;
	int queryNumber;
	
	int min_query;
	double min_cost;

	inline std::string getName();
	
	void findCosts(QueryStorage *qs);
	void getGenerators(Query *query);
public:
	SearchEngine(std::string name, Query *query);
	virtual ~SearchEngine();

	virtual void search() = 0;
};

bool sort_by_cost(QueryInfo *qi1, QueryInfo *qi2);

#endif